<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象的引用传址</title>
</head>
<body>
    <script>
        // a是值类型，原先的值不会被改变
        let a = 1;
        function test(a){
            console.log(a+1);   //a=2
        }
        test(a);
        console.log(a); //a=1


        
        // user对象是引用类型，原先的值会被改变
        let user = {
            age : 18
        };
        function show(a){
            a.name = "xiasnn";
            console.log(a);  //{age: 18,name: "xiasnn"}
        };
        show(user);
        console.log(user);  //{age: 18,name: "xiasnn"}
    </script>
</body>
</html>